// 用于改变时间戳转换格式
export function getTimeYear(time) {
	let date = new Date(time)
	let year = date.getFullYear()
	return year
}

// 转换为YYYY-MM-DD格式
export function getTimeYMD(time) {
	let date = new Date(time)
	let year = date.getFullYear()
	let month = date.getMonth() + 1
	// 假如是单数的时候在前面添0
	if(month < 10) {
		month = '0' + month
	}
	let day = date.getDate()
	if(day < 10) {
		day = '0' + day
	}
	return year + '-' + month + '-' + day
}

// 转换为YYYY-MM-DD HH-MM-SS格式
export function getTime(time) {
	let date = new Date(time)
	let year = date.getFullYear()
	let month = date.getMonth() + 1
	if(month < 10) {
		month = '0' + month
	}
	let day = date.getDate()
	if(day < 10) {
		day = '0' + day
	}
	let hour = date.getHours()
	if(hour < 10) {
		hour = '0' + hour
	}
	let minutes = date.getMinutes()
	if(minutes < 10) {
		minutes = '0' + minutes
	}
	let seconds = date.getSeconds()
	if(seconds < 10) {
		seconds = '0' + seconds
	}
	let trueTime = year + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
	return trueTime
}